<template>
  <div>
    <el-row>
      <el-button type="danger" plain @click="deletes">批量删除</el-button>
      <el-button type="primary" plain @click="dialogVisible = true"
        >新增</el-button
      >
    </el-row>
    <el-dialog
      title="提示"
      v-model="dialogVisible"
      width="30%"
      :destroy-on-close="true"
    >
      <el-form ref="brand" :model="brand" label-width="80px">
        <el-form-item label="*品牌名称">
          <el-input v-model="brand.brandName"></el-input>
        </el-form-item>
        <br />
        <el-form-item label="*企业名称">
          <el-input v-model="brand.companyName"></el-input>
        </el-form-item>
        <br />
        <el-form-item label="排序">
          <el-input v-model="brand.ordered"></el-input>
        </el-form-item>
        <br />
        <el-form-item label="备注">
          <el-input type="textarea" v-model="brand.description"></el-input>
        </el-form-item>
        <br />
        <el-form-item label="状态">
          <el-switch
            v-model="brand.status"
            active-value="1"
            inactive-value="0"
          ></el-switch>
        </el-form-item>
      </el-form>

      <template #footer>
        <span class="dialog-footer">
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="submit(brand)">提交</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script>
import { reactive, ref } from "@vue/reactivity";

import { useRouter } from "vue-router";
import { ElMessageBox } from "element-plus";
import { ElMessage } from "element-plus";
export default {
  props: {
    multipleSelection: {
      type: Array,
    },
  },
  data() {
    return {
      brand: {
        brandName: "",
        companyName: "",
        ordered: "",
        description: "",
        status: "",
      },
    };
  },
  setup(props, context) {
    const deletes = () => {

          context.emit("deletes");
         
    };
    const router = useRouter();
    let dialogVisible = ref(false);

    const submit = (data) => {
      dialogVisible.value = false;

      context.emit("addbrands", data);
    };
    return {
      deletes,
      submit,
      dialogVisible,
    };
  },
};
</script>

<style scoped>
.el-form {
  padding: 20px;
}
.el-row {
  margin: 0px;
 
  margin-top: 5px;
  margin-left: 20px;
}
</style>